//
//  BZBaseNavigationController.m
//  Pods
//
//  Created by 郭艺伟 on 2017/9/25.
//
//

#import "BZBaseNavigationController.h"

@interface BZBaseNavigationController ()

@end

@implementation BZBaseNavigationController

/**
 *  第一次使用这个类的时候会调用(1个类只会调用1次)
 *  每个类只调用一次initialize。这个调用的时间发生在你的类接收到消息之前，但是在它的父类接收到initialize之后。
 */
+ (void)initialize
{
    // 1.设置导航栏主题
    [self setupNavBarTheme];
    
    // 2.设置导航栏按钮主题
    [self setupBarButtonItemTheme];
}


/**
 *  设置导航栏按钮主题
 */
+ (void)setupBarButtonItemTheme
{
    /*
    UIBarButtonItem *item = [UIBarButtonItem appearance];
    
    // 设置背景
    [item setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    [item setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
    [item setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:UIControlStateDisabled barMetrics:UIBarMetricsDefault];
    
    // 设置文字属性
    NSDictionary *textAttriutes = @{
                                    NSFontAttributeName: [UIFont systemFontOfSize:15],
                                    NSForegroundColorAttributeName: [UIColor whiteColor],
                                    };
    [item setTitleTextAttributes:textAttriutes forState:UIControlStateNormal];
    [item setTitleTextAttributes:textAttriutes forState:UIControlStateHighlighted];
    
    
    NSDictionary *disableTextAttrs = @{
                                       NSFontAttributeName: [UIFont systemFontOfSize:15],
                                       NSForegroundColorAttributeName: [UIColor lightGrayColor],
                                       };
    [item setTitleTextAttributes:disableTextAttrs forState:UIControlStateDisabled];*/
}

/**
 *  设置导航栏Bar主题
 */
+ (void)setupNavBarTheme
{
    /*
    // 取出appearance对象
    UINavigationBar *navBar = [UINavigationBar appearance];
    
    // 设置背景
    [navBar setBackgroundImage:[UIImage imageWithColor:[UIColor brownColor]] forBarMetrics:UIBarMetricsDefault];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    
    // 设置标题属性
    NSDictionary *textAttriutes = @{
                                    NSFontAttributeName: [UIFont boldSystemFontOfSize:18.0],
                                    NSForegroundColorAttributeName: [UIColor whiteColor],
                                    };
    [navBar setTitleTextAttributes:textAttriutes];
    
    // 设置返回按钮的箭头颜色
    [navBar setTintColor:[UIColor whiteColor]];*/
    
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}


@end
